﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Quadarax.Foundation.IO
{
    public class QIndexedFileEnumerator : System.Collections.IEnumerator
    {
        private QIndexedFile m_oFile = null;
        private int m_nIndex = -1;

        public QIndexedFileEnumerator(QIndexedFile oFile)
        {
            m_oFile = oFile;
        }

        public object Current
        {
            get
            {
                try
                {
                    return m_oFile[m_nIndex];
                }
                catch (IndexOutOfRangeException)
                {
                    throw new InvalidOperationException();
                }
            }
        }

        public bool MoveNext()
        {
            m_nIndex++;
            return (m_nIndex < m_oFile.Count);
        }

        public void Reset()
        {
            m_nIndex = -1;
        }

    }


}
